#ifndef master_volume_h_
#define master_volume_h_

#include "jolfs/volume.h"
#include "jolfs/inode.h"

namespace jolfs
{

  //
  // Master Volume
  //  A master volume is the main piece to
  //  access to the data. In fact it is a composition
  //  of volume. 
  class MasterVolume : Volume
  {
    
  public:

    // CONSTRUCTORS
    MasterVolume();
    MasterVolume(const std::string& name,
		 		 const std::string& mountPoint);
    ~MasterVolume();
    

    // ACCESSORS
    const std::string& mountPoint() const;

    // METHODS
    
    // Append a volume to the master.
    // @param vol: the volume to append.
    void appendVolume(Volume* vol);

    
    // Lookup
    //   get information about an entry. An entry can be any type.
    //   We try to keep in a map, the association between inode_t
    //   and the entry information.
    bool lookup(INode* parent, const std::string& name, 
				INode& ei);
    

    // From Volume
    virtual void shutdown();

  private:
    
    // DATA
    std::string     mountPoint_;
    VolumeSeq       volumes_;
  };

	// ---------------------------------------------
	// I N L I N E S
  	// ---------------------------------------------
	inline MasterVolume::MasterVolume() {}

	inline MasterVolume::MasterVolume(const std::string& name,
				  				    const std::string& mountPoint):
    Volume(name), mountPoint_(mountPoint)
  {
  }
  
  inline const std::string& MasterVolume::mountPoint() const
  {
    return mountPoint_;
  }
}

#endif
